import request from '@/utils/request'

// 查询商品现价、库存和是否有效
export const getNewCartGoods = (skuId) => {
  return request(`/goods/stock/${skuId}`, 'get')
}
// 获取商品规格信息
export const getGoodsSku = (skuId) => {
  return request(`/goods/sku/${skuId}`, 'get')
}
// 合并购物车
export const mergeCart = (cartList) => {
  return request('/member/cart/merge', 'post', cartList)
}
// 获取购物车
export const findCart = () => {
  return request('/member/cart', 'get')
}
// 加入购物车
export const insertCart = ({ skuId, count }) => {
  return request('/member/cart', 'post', { skuId, count })
}
// 删除购物车商品
export const deleteCart = (ids) => {
  return request('/member/cart', 'delete', { ids })
}
// 修改购物车商品属性
export const updateCart = ({ skuId, selected, count }) => {
  return request(`/member/cart/${skuId}`, 'put', { selected, count })
}
// 购物车商品全选
export const ckeckAllCart = ({ selected, ids }) => {
  return request('/member/cart/selected', 'put', { selected, ids })
}
